﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Web.UI.WebControls;
using BabyFood.Data;
using BabyFood.Entities;

/// <summary>
/// Summary description for BindCatalog
/// </summary>
public class BindCatalog
{
    public BindCatalog()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public static void BindNhomTin(DropDownList cboCatalog)
    {
        TList<DmLoaiTinTuc> TList_Catalog = DataRepository.DmLoaiTinTucProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "Ten";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Nhóm tin --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    //public static void BindLoaiGioiThieu(DropDownList cboCatalog)
    //{
    //    TList<DmLoaiGioiThieu> TList_Catalog = DataRepository.DmLoaiGioiThieuProvider.Find("TrangThai=True");
    //    cboCatalog.DataSource = TList_Catalog;
    //    cboCatalog.DataTextField = "Ten";
    //    cboCatalog.DataValueField = "Id";
    //    cboCatalog.DataBind();
    //    ListItem ItemChoose = new ListItem();
    //    ItemChoose.Text = " -- Loại giới thiệu --";
    //    ItemChoose.Value = "0";
    //    cboCatalog.Items.Insert(0, ItemChoose);
    //}

    //public static void BindLienKet(DropDownList cboCatalog)
    //{
    //    TList<LienKet> TList_Catalog = DataRepository.LienKetProvider.GetAll();
    //    cboCatalog.DataSource = TList_Catalog;
    //    cboCatalog.DataTextField = "Ten";
    //    cboCatalog.DataValueField = "DiaChi";
    //    cboCatalog.DataBind();
    //    ListItem ItemChoose = new ListItem();
    //    ItemChoose.Text = " -- Liên kết Website --";
    //    ItemChoose.Value = "0";
    //    cboCatalog.Items.Insert(0, ItemChoose);
    //}

    public static void BindBoSuuTap(DropDownList cboCatalog)
    {
        TList<BoSuuTap> TList_Catalog = DataRepository.BoSuuTapProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "Ten";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Bộ sưu tập --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    //public static void BindNhomLK(DropDownList cboCatalog)
    //{
    //    TList<DmLoaiLienKet> TList_Catalog = DataRepository.DmLoaiLienKetProvider.Find("TrangThai=True");
    //    cboCatalog.DataSource = TList_Catalog;
    //    cboCatalog.DataTextField = "Ten";
    //    cboCatalog.DataValueField = "Id";
    //    cboCatalog.DataBind();
    //    ListItem ItemChoose = new ListItem();
    //    ItemChoose.Text = " -- Nhóm liên kết --";
    //    ItemChoose.Value = "0";
    //    cboCatalog.Items.Insert(0, ItemChoose);
    //}

    public static void BindSubTin(DropDownList cboCatalog)
    {
        TList<DmSubTinTuc> TList_Catalog = DataRepository.DmSubTinTucProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenSubTinTuc";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Sub Tin --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static void BindNhomQuangCao(DropDownList cboCatalog)
    {
        TList<DmQuangCao> TList_Catalog = DataRepository.DmQuangCaoProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenNhomQuangCao";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tên Nhóm Quảng Cáo --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static IDictionary<short?, string> Album
    {
        get
        {
            Dictionary<short?, string> thu = new Dictionary<short?, string>();


            thu.Add(1, "Album Ảnh của bé");
            thu.Add(2, "Album Ảnh thời ấu thơ");

            return thu;
        }
    }
    public static void AlbumNhom(DropDownList cboCatalog)
    {

        cboCatalog.DataSource = Album;

        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Album --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindNhomAlbum(DropDownList cboCatalog)
    {
        TList<NhomAlbum> TList_NhomAlbum = DataRepository.NhomAlbumProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_NhomAlbum;
        cboCatalog.DataTextField = "TenNhomAlbum";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tên Nhóm Album --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

}
